import process from 'process'

export class IParams {
    pipelineID!: number

    pipelineName!: string

    buildNumber?: number

    workSpace!: string

    projectDir!: string

    buildJobID!: number

    regionID!: string

    namespace!: string

    pathToYaml!: string

    images!: string
}

export function getParams(): IParams {
    let params = new IParams()
    params.pipelineID = Number(process.env.PIPELINE_ID)
    params.pipelineName = process.env.PIPELINE_NAME as string
    params.buildNumber = Number(process.env.BUILD_NUMBER)
    params.workSpace = process.env.WORK_SPACE as string
    params.projectDir = process.env.PROJECT_DIR as string
    params.buildJobID = Number(process.env.BUILD_JOB_ID)
    params.regionID = process.env.REGION_ID as string
    params.namespace = process.env.NAMESPACE ? process.env.NAMESPACE : ''
    params.pathToYaml = process.env.PATH_TO_YAML ? process.env.PATH_TO_YAML : 'manifests'
    params.images = process.env.IMAGES as string

    return params
}